package 汽车租赁系统;

public class yeWu {

    Che[] chezu=new Che[8];
    public void ku(){
        chezu[0]=new jiaoChe("宝马","京NY12138",800,"x6");
        /*chezu[1]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[2]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[3]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[4]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[5]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[6]=new jiaoChe("宝马","京NY12138",800,"x6");
        chezu[7]=new jiaoChe("宝马","京NY12138",800,"x6");*/
    }
    public yeWu(){
        ku();
    }
    public Che _che (String pinpai,int zuowei,String xinghao){
        Che motor=null;
        for (int i=0;i<chezu.length;i++){
            if (chezu[i] instanceof jiaoChe){
                jiaoChe jiaoche1=(jiaoChe)chezu[i];
                if (jiaoche1.getPinPai().equals(pinpai)&&jiaoche1.getXinghao().equals(xinghao)){
                    motor=jiaoche1;
                    break;
                }
            }else if (chezu[i] instanceof KeChe){
                KeChe keche=(KeChe)chezu[i];
                if (keche.getPinPai().equals(pinpai)&&keche.getZuowei()==zuowei){
                    motor=keche;
                    break;
                }
            }
        }
        return motor;
    }





}
